<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加权限组</title>
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css" media="all">
<link rel="stylesheet" href="__PUBLIC__/admin/css/admin.css">
</head>
<body class="layui-bg-gray">
	<div class="layui-fluid">
		<div class="layui-row layui-col-space10">
			<div class="layui-col-md12 layui-col-xs12">
				<div class="layui-card">
					<div class="layui-card-body">
						<form class="layui-form" action="">
							<div class="layui-form-item">
								<label class="layui-form-label">权限组名称</label>
								<div class="layui-input-block">
									<input type="text" name="privilege_name" required
										lay-verify="required" placeholder="请输入权限组名称" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">备注</label>
								<div class="layui-input-block">
									<textarea name="remark" placeholder="请输入备注" class="layui-textarea"></textarea>
								</div>
							</div>
							<div class="layui-form-item">
								<div class="layui-input-block">
									<button class="layui-btn" lay-submit lay-filter="formDemo">保存并继续添加</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script src="__PUBLIC__/layui/layui.js"></script>
	<script type="text/javascript"
		src="__PUBLIC__/common/js/jquery-2.0.3.min.js"></script>
	<script type="text/javascript">
		$(function() {
			layui.use('form', function() {
				var form = layui.form;
				form.on('submit(formDemo)', function(data) {
					//layer.msg(JSON.stringify(data.field));
					var index = layer.load();
					$.ajax({
						type : "POST",
						url : "{:U('Limits/addPrivilege')}",
						data : {
							info : data.field
						},
						success : function(res) {
							layer.close(index);
							if (res.status == 1) {
								layer.msg(res.info);
								layui.data('cache', {
									key : 'status',
									value : true
								});
							} else {
								layer.msg(res.info);
							}
						}
					});
					return false;
				});
			});
		});
	</script>
</body>
</html>